"""
pip install -i https://pypi.douban.com/simple locustio

在该文件目录下执行 locust --host=127.0.0.1

浏览器打开http://localhost:8089/

Number of users to simulate：并发数
Hatch rate (users spawned/second)：每秒启动的用户数

"""
from locust import HttpLocust, TaskSet, task


class ESTasks(TaskSet):
    @task
    def search_task1(self):
        self.client.post("http://127.0.0.1:9200/kgqa/search?pretty",
                         {
                             "query": {"match": {"value": "618055198902016806"}}
                         })

    @task
    def search_task(self):
        self.client.post("https://www.baidu.com/")


class RunTasks(HttpLocust):
    task_set = ESTasks
    min_wait = 3000  # 单位为毫秒
    max_wait = 6000  # 单位为毫秒
